import React from "react";
class Reg extends React.Component {
    constructor() {
        super();
         
    }
    submit = (e) => {

        let { username, pwd } = this;
        console.log(username.value);
        console.log(pwd.value);
        e.preventDefault();

    }
    submit2 = (e) => {

  
        console.log(e.target["username"].value);
        console.log(e.target["pwd"].value);
        e.preventDefault();
    }
    render() {
        return <div>

            {/* <form onSubmit={this.submit}>
                <div>账号：<input ref={c => this.username = c} type="text" /></div>
                <div>密码<input ref={c => this.pwd = c} type="text" /></div>
                <div><button>注册</button></div>
            </form> */}

            
<form onSubmit={this.submit2}>
                <div>账号：<input name="username" type="text" /></div>
                <div>密码<input name="pwd" type="text" /></div>
                <div><button>注册</button></div>
            </form>
        </div>
    }
}
export default Reg;